﻿<Window x:Class="TelescopeScripting.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Telescope Control" SizeToContent="WidthAndHeight" Background="#FF706767" ResizeMode="NoResize"
        FontSize="14"
        >
    <Grid Width="Auto" Height="Auto">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="310"/>
            <ColumnDefinition Width="175"/>
            <ColumnDefinition Width="310"/>
            <ColumnDefinition Width="175"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="35"/>
            <RowDefinition Height="310"/>
        </Grid.RowDefinitions>
        <Menu Grid.RowSpan="1" Grid.ColumnSpan="4" Name="MainMenu" Margin="0,0,0,3" VerticalAlignment="Top">
            <MenuItem Header="File">
                <MenuItem Header="Set RTGUI Path" Click="MenuItem_RTGUIPath"/>
                <MenuItem Header="Close Application" Click="MenuItem_Close"/>
            </MenuItem>
            <MenuItem Header="Play Lists">
                <MenuItem Header="New Play List" Click="MenuItem_NewPlaylist"/>
                <MenuItem Header="Open Play List" Click="MenuItem_OpenPlaylist"/>
                <MenuItem Header="Save Play List" Click="MenuItem_SavePlaylist"/>
            </MenuItem>
            <MenuItem Header="Scripts">
                <MenuItem Header="New script" Click="MenuItem_New"/>
                <MenuItem Header="Open script" Click="MenuItem_Open"/>
                <MenuItem Header="Save script" Click="MenuItem_Save"/>
            </MenuItem>
            <MenuItem Header="Create Catalog" Click="MenuItem_CreateCatalog"/>
        </Menu>
        <WrapPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">
            <Label Content="Playlist name: "  HorizontalAlignment="Center"  Foreground="White"/>
            <TextBox Name="PlayListNameLabel" Text="" VerticalContentAlignment="Center" Width="150" Background="#FFB9B9B9" BorderBrush="Black" BorderThickness="0"/>
        </WrapPanel>

        <ListBox Grid.Row="2" Grid.Column="0" Grid.RowSpan="2" Name="PlayListCommands" Height="300" Width="300" Background="#FF1D1D1D" Foreground="White" Margin="3" BorderThickness="0">
            <ListBox.ItemTemplate>
                <ItemContainerTemplate>
                    <Border CornerRadius="3" BorderBrush="AliceBlue" BorderThickness="0" Background="#FF212121" Width="280">
                        <TextBlock Text="{Binding}" Foreground="LightBlue" VerticalAlignment="Center" Padding="3"/>
                    </Border>
                </ItemContainerTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" VerticalAlignment="Bottom" Margin="2">
            <Button Name="AddPlayList" ToolTip="Add Script to playlist" Width="35" Margin="1" Click="AddPlayList_Click" HorizontalAlignment="Left">
                <Image Source="Resources/plus79.png"/>
            </Button>
            <Button Name="InsertPlayList" ToolTip="Insert script to playlist" Width="35" Margin="1" Click="InsertPlayList_Click" HorizontalAlignment="Left">
                <Image Source="Resources/insert9.png"/>
            </Button>
            <Button Name="UpPlay" Click="UpPlay_Click_1" ToolTip="Move the selected script up the play list" Width="35" HorizontalAlignment="Left" Margin="1,25,1,1">
                <Image Source="Resources/up7.png"/>
            </Button>
            <Button Name="RemovePlay" Click="RemovePlay_Click_1" ToolTip="Remove the selected script from the playlist" Width="35" HorizontalAlignment="Left" Margin="1">
                <Image Source="Resources/cross97.png"/>
            </Button>
            <Button Name="DownPlay" Click="DownPlay_Click_1" ToolTip="Move the selected script down the playlist" Width="35" HorizontalAlignment="Left" Margin="1">
                <Image Source="Resources/up7.png" RenderTransformOrigin="0.5,0.5">
                    <Image.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform Angle="180"/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Image.RenderTransform>
                </Image>
            </Button>
            <WrapPanel>
                <Button  x:Name="ExecutePlayList" Width="35" ToolTip="Run Playlist" HorizontalAlignment="Left" Click="ExecutePlayList_Click_1" Margin="1,18,0,1" VerticalAlignment="Bottom">
                    <Image Source="Resources/telescope14.png"/>
                </Button>
                <Button  x:Name="StopPlayList" ToolTip="Stop Script or Playlist" Click="StopCommands_Click_1" Margin="1,18,0,1" HorizontalAlignment="Left" Width="35">
                    <Image Source="Resources/track4.png"/>
                </Button>
            </WrapPanel>

        </StackPanel>
        <WrapPanel Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">
            <Label Content="Script name: " HorizontalAlignment="Center"  Foreground="White"/>
            <TextBox Name="ScriptNameLabel" Text="" VerticalContentAlignment="Center" Width="150" Background="#FFB9B9B9" BorderBrush="Black" BorderThickness="0"/>
        </WrapPanel>

        <ListBox Grid.Row="2" Grid.RowSpan="2" Grid.Column="2" Name="ScriptingCommands" Height="300" Width="300" BorderThickness="0" Background="#FF1D1D1D" Foreground="White" SelectionChanged="ScriptingCommands_SelectionChanged_1" Margin="3">
            <ListBox.ItemTemplate>
                <ItemContainerTemplate>
                    <Border CornerRadius="3" BorderBrush="AliceBlue" BorderThickness="0" Background="#FF212121" Width="280">
                        <TextBlock Text="{Binding}" Foreground="LightBlue" VerticalAlignment="Center" Padding="3"/>
                    </Border>
                </ItemContainerTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Column="3" Grid.Row="2" Grid.RowSpan="2" VerticalAlignment="Bottom">
            <StackPanel Width="Auto" HorizontalAlignment="Left"  Margin="1" VerticalAlignment="Bottom">
                <Label Content="Command: " Margin="1"  Width="100" HorizontalAlignment="Left" Foreground="White" />
                <ComboBox Name="ComboBoxCommand" Width="Auto" MinWidth="150" Margin="1" SelectionChanged="ComboBoxCommand_SelectionChanged_1">
                    <ComboBoxItem Content="cat" ToolTip="Changes the catalog"/>
                    <ComboBoxItem Content="find" ToolTip="Finds and object in the current catalog"/>
                    <ComboBoxItem Content="minal" ToolTip="Sepcifies a minimum altitude in degrees for objects in a search"/>
                    <ComboBoxItem Content="minmag" ToolTip="Specifies a miniumum magnitue for objects to match in a search"/>
                    <ComboBoxItem Content="name2" ToolTip="specifies a second name that is to be matched in a search"/>
                    <ComboBoxItem Content="match" ToolTip="Finds the next object in the catalog matching the search criteria"/>
                    <ComboBoxItem Content="planet">
                        <ComboBoxItem.ToolTip>
                            <TextBlock Text="Finds one of the major planets. Sun=0, Mercury=1, Venus=2, Moon=3, Mars=4, Jupiter=5, Saturn=6, Uranus=7, Neptune=8, Pluto=9" />
                        </ComboBoxItem.ToolTip>
                    </ComboBoxItem>
                    <ComboBoxItem Content="2000ra" ToolTip="Selects the position of an object in terms of RA and DEC for a given epoch"/>
                    <ComboBoxItem Content="alt" ToolTip="Selects the position of an object in terms of its current altitude and azimuth"/>
                    <ComboBoxItem Content="wait" ToolTip="Tells RTGUI+S to wait until the specified time until performing the next command"/>
                    <ComboBoxItem Content="date" ToolTip="Used in conjuction with the wait command; specifies a day of the month on which the wait command is to wake up"/>
                    <ComboBoxItem Content="sleep" ToolTip="The number of seconds to sleep before performing the next command"/>
                    <ComboBoxItem Content="command" ToolTip="Controls the sequence in which RTGUI+S commands are executed by allowing you to 'go to' a particular command number"/>
                    <ComboBoxItem Content="exit" ToolTip="specifies a time after which command processing will cease"/>
                    <ComboBoxItem Content="shell" ToolTip="Causes the execution of some other program; perhaps to control a device like a camera"/>
                    <ComboBoxItem Content="goto" ToolTip="causes the telescope to Goto the currently selected object or position"/>
                    <ComboBoxItem Content="stay" ToolTip="Tells RTGUI+S to stay resident when command process is finished"/>
                    <ComboBoxItem Content="sky" ToolTip="Invokes the Skycharts program to produce a sky chart centered on the selected object"/>
                </ComboBox>
            </StackPanel>

            <StackPanel HorizontalAlignment="Left" Margin="1">
                <!--<Label Content="Value:" Margin="1" Width="100" HorizontalAlignment="Left"/>-->
                <TextBox Name="CommandValue" Text="" Height="25" Width="150" MinWidth="150" Margin="1" HorizontalAlignment="Left" VerticalContentAlignment="Center" TextChanged="CommandValue_TextChanged" Background="#FFB9B9B9" BorderBrush="Black" BorderThickness="0"/>
                <WrapPanel  HorizontalAlignment="Center">
                    <Button Name="AddCommand" Width="35" Margin="1" Click="AddCommand_Click_1" ToolTip="Add command to script">
                        <Image Source="Resources/plus79.png"/>
                    </Button>
                    <Button Name="InsertCommand" Width="35" Margin="1" Click="InsertCommand_Click" ToolTip="Insert command above selected item">
                        <Image Source="Resources/insert9.png"/>
                    </Button>
                    <Button Name="ModifyCommand" ToolTip="Modify the selected command" Width="35" Margin="1" Click="ModifyCommand_Click_1">
                        <Image Source="Resources/exchange1.png"/>
                    </Button>
                </WrapPanel>
            </StackPanel>

            <Button Name="Up" Click="Up_Click_1" Width="35" ToolTip="Move the selected command up the list" HorizontalAlignment="Left" Margin="1,25,1,1">
                <Image Source="Resources/up7.png"/>
            </Button>
            <Button Name="Remove" Click="Remove_Click_1" Width="35" ToolTip="Remove the selected command from the list"
                     HorizontalAlignment="Left" Margin="1">
                <Image Source="/Resources/cross97.png"/>
            </Button>
            <Button Name="Down" Click="Down_Click_1" ToolTip="Move the selected command down the list" Width="35" HorizontalAlignment="Left" Margin="1" RenderTransformOrigin="0.5,0.5">
                <Button.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform Angle="180"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Button.RenderTransform>
                <Image Source="/Resources/up7.png" />
            </Button>
            <WrapPanel>
                <Button  x:Name="ExecuteCommands" ToolTip="Run Script" Click="ExecuteCommands_Click_1" Margin="1,18,0,1" HorizontalAlignment="Left" Width="35">
                    <Image Source="Resources/telescope14.png"/>
                </Button>
                <Button  x:Name="StopCommands" ToolTip="Stop Script or Playlist" Click="StopCommands_Click_1" Margin="1,18,0,1" HorizontalAlignment="Left" Width="35">
                    <Image Source="Resources/track4.png"/>
                </Button>
            </WrapPanel>

        </StackPanel>
    </Grid>
</Window>
